import os
import sys
from ament_index_python import get_package_share_directory
from launch import LaunchDescription, LaunchIntrospector, LaunchService
from launch_ros import actions
def generate_launch_description():
    config_file = os.path.join(get_package_share_directory("imu_driver"),"config","imu_start.yaml")
    driver_node=actions.Node(
        package='imu_driver',
        executable='imu_serial_node',
        output='screen',
        parameters=[config_file]
    )
    return LaunchDescription([driver_node])

def main(argv):
    ld = generate_launch_description()

    print('Starting introspection of launch description...')
    print('')

    print(LaunchIntrospector().format_launch_description(ld))

    print('')
    print('Starting launch of launch description...')
    print('')

    ls = LaunchService()
    ls.include_launch_description(ld)
    return ls.run()


if __name__ == '__main__':
    main(sys.argv)
